home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / various.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  34.0 KB  |  888 lines

  1. *various.txt*   For Vim version 6.0.  Last change: 2001 Sep 15
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Various commands                    *various*
  8.  
  9. 1. Various commands        |various-cmds|
  10. 2. Online help            |online-help|
  11. 3. Printing            |printing|
  12. 4. Using Vim like less or more    |less|
  13.  
  14. ==============================================================================
  15. 1. Various commands                    *various-cmds*
  16.  
  17.                             *CTRL-L*
  18. CTRL-L            Clear and redraw the screen (later).
  19.  
  20.                             *:redr* *:redraw*
  21. :redr[aw][!]        Redraw the screen right now.  When ! is included it is
  22.             cleared first.
  23.             Useful to update the screen halfway executing a script
  24.             or function.  Also when halfway a mapping and
  25.             'lazyredraw' is set.
  26.  
  27.                             *N<Del>*
  28. <Del>            When entering a number: Remove the last digit.
  29.             Note: if you like to use <BS> for this, add this
  30.             mapping to your .vimrc:
  31.                 :map CTRL-V <BS>   CTRL-V <Del>
  32.             See |:fixdel| if your <Del> key does not do what you
  33.             want.
  34.  
  35. :as[cii]    or                    *ga* *:as* *:ascii*
  36. ga            Print the ascii value of the character under the
  37.             cursor in decimal, hexadecimal and octal.  For
  38.             example, when the cursor is on a 'R':
  39.                 <R>  82,  Hex 52,  Octal 122
  40.             When the character is a non-standard ASCII character,
  41.             but printable according to the 'isprint' option, the
  42.             non-printable version is also given.  When the
  43.             character is larger than 127, the <M-x> form is also
  44.             printed.  For example:
  45.                 <~A>  <M-^A>  129,  Hex 81,  Octal 201
  46.                 <p>  <|~>  <M-~>  254,  Hex fe,  Octal 376
  47.             (where <p> is a special character)
  48.             The <Nul> character in a file is stored internally as
  49.             <NL>, but it will be shown as:
  50.                 <^@>  0,  Hex 00,  Octal 000
  51.             Mnemonic: Get Ascii value.  {not in Vi}
  52.  
  53.                             *g8*
  54. g8            Print the hex values of the bytes used in the
  55.             character under the cursor, assuming it is in |UTF-8|
  56.             encoding.  This also shows composing characters.
  57.             Example of a character with three composing
  58.             characters: >
  59.                 e0 b8 81 + e0 b8 b9 + e0 b9 89
  60. <            {not in Vi}
  61.  
  62.                             *:p* *:pr* *:print*
  63. :[range]p[rint]        Print [range] lines (default current line).
  64.             Note: If you are looking for a way to print your text
  65.             file, you need an external program for that.  In the
  66.             GUI you can use the File.Print menu entry.
  67.             (For printing on paper see |:hardcopy|)
  68.  
  69. :[range]p[rint] {count}
  70.             Print {count} lines, starting with [range] (default
  71.             current line |cmdline-ranges|).
  72.  
  73.                             *:P* *:Print*
  74. :[range]P[rint] [count]
  75.             Just as ":print".  Was apparently added to Vi for
  76.             people that keep the shift key pressed too long...
  77.  
  78.                             *:l* *:list*
  79. :[range]l[ist] [count]
  80.             Same as :print, but display unprintable characters
  81.             with '^'.
  82.  
  83.                             *:nu* *:number*
  84. :[range]nu[mber] [count]
  85.             Same as :print, but precede each line with its line
  86.             number.  (See also 'highlight' option).
  87.  
  88.                             *:#*
  89. :[range]# [count]    synonym for :number.
  90.  
  91.                             *:z* *E144*
  92. :{range}z[+-^.=]{count}    Display several lines of text surrounding the line
  93.             specified with {range}, or around the current line
  94.             if there is no {range}.  If there is a {count}, that's
  95.             how many lines you'll see; otherwise, the current
  96.             window size is used.
  97.  
  98.             :z can be used either alone or followed by any of
  99.             several punctuation marks.  These have the following
  100.             effect:
  101.  
  102.             mark   first line    last line      new location   ~
  103.             ----   ----------    ---------      ------------
  104.             +      current line  1 scr forward  1 scr forward
  105.             -      1 scr back    current line   current line
  106.             ^      2 scr back    1 scr back     1 scr back
  107.             .      1/2 scr back  1/2 scr fwd    1/2 src fwd
  108.             =      1/2 src back  1/2 scr fwd    current line
  109.  
  110.             Specifying no mark at all is the same as "+".
  111.             If the mark is "=", a line of dashes is printed
  112.             around the current line.
  113.  
  114. :{range}z#[+-^.=]{count}                *:z#*
  115.             Like ":z", but number the lines.
  116.             {not in all versions of Vi, not with these arguments}
  117.  
  118.                             *:=*
  119. :=            Print the cursor line number.
  120.  
  121. :{range}=        Prints the last line number in {range}.
  122.  
  123. :norm[al][!] {commands}                    *:norm* *:normal*
  124.             Execute Normal mode commands {commands}.  This makes
  125.             it possible to execute Normal mode commands typed on
  126.             the command-line.  {commands} is executed like it is
  127.             typed.  For undo all commands are undone together.
  128.             If the [!] is given, mappings will not be used.
  129.             {commands} should be a complete command.  If
  130.             {commands} does not finish a command, the last one
  131.             will be aborted as if <Esc> was typed.  The display
  132.             isn't updated while doing this.  This implies that an
  133.             insert command must be completed (to start Insert
  134.             mode, see |:startinsert|).  A ":" command must be
  135.             completed as well.
  136.             The 'insertmode' option is ignored for {commands}.
  137.             This command cannot be followed by another command,
  138.             since any '|' is considered part of the command.
  139.             This command can be used recursively, but the depth is
  140.             limited by 'maxmapdepth'.
  141.             When this command is called from a non-remappable
  142.             mapping |:noremap|, the argument can be mapped anyway.
  143.             An alternative is to use |:execute|, which uses an
  144.             expression as argument.  This allows the use of
  145.             printable characters.  Example: >
  146.                 :exe "normal \<c-w>\<c-w>"
  147. <            {not in Vi, of course}
  148.             Not available when |+ex_extra| feature was disabled at
  149.             compile time.
  150.  
  151. :{range}norm[al][!] {commands}                *:normal-range*
  152.             Execute Normal mode commands {commands} for each line
  153.             in the {range}.  Before executing the {commands}, the
  154.             cursor is positioned in the first column of the range,
  155.             for each line.  Otherwise it's the same as the
  156.             ":normal" command without a range.
  157.             {not in Vi}
  158.             Not available when |+ex_extra| feature was disabled at
  159.             compile time.
  160.  
  161.                             *:sh* *:shell* *E371*
  162. :sh[ell]        This command starts a shell.  When the shell exits
  163.             (after the "exit" command) you return to Vim.  The
  164.             name for the shell command comes from 'shell' option.
  165.                             *E360*
  166.             Note: This doesn't work when Vim on the Amiga was
  167.             started in QuickFix mode from a compiler, because the
  168.             compiler will have set stdin to a non-interactive
  169.             mode.
  170.  
  171.                             *:!cmd* *:!* *E34*
  172. :!{cmd}            Execute {cmd} with the shell.  See also the 'shell'
  173.             and 'shelltype' option.
  174.             Any '!' in {cmd} is replaced with the previous
  175.             external command (see also 'cpoptions').  But not when
  176.             there is a backslash before the '!', then that
  177.             backslash is removed.  Example: ":!ls" followed by
  178.             ":!echo ! \! \\!" executes "echo ls ! \!".
  179.             After the command has been executed, the timestamp of
  180.             the current file is checked |timestamp|.
  181.             There cannot be a '|' in {cmd}, see |:bar|.
  182.             On Unix the command normally runs in a non-interactive
  183.             shell.  If you want an interactive shell to be used
  184.             (to use aliases) set 'shellcmdflag' to "-ic".
  185.             For Win32 also see |:!start|.
  186.             Vim redraws the screen after the command is finished,
  187.             because it may have printed any text.  This requires a
  188.             hit-enter prompt, so that you can read any messages.
  189.             To avoid this use: >
  190.                 :silent !{cmd}
  191. <            The screen is not redrawn then, thus you have to use
  192.             CTRL-L or ":redraw!" if the command did display
  193.             something.
  194.             Also see |shell-window|.
  195.  
  196.                             *:!!*
  197. :!!            Repeat last ":!{cmd}".
  198.  
  199.                             *:ve* *:version*
  200. :ve[rsion]        Print the version number of the editor.  If the
  201.             compiler used understands "__DATE__" the compilation
  202.             date is mentioned.  Otherwise a fixed release-date is
  203.             shown.
  204.             The following lines contain information about which
  205.             features were enabled when Vim was compiled.  When
  206.             there is a preceding '+', the feature is included,
  207.             when there is a '-' it is excluded.  To change this,
  208.             you have to edit feature.h and recompile Vim.
  209.             To check for this in an expression, see |has()|.
  210.             Here is an overview of the features.
  211.             The first column shows the smallest version in which
  212.             they are included:
  213.                T    tiny
  214.                S    small
  215.                N    normal
  216.                B    big
  217.                H    huge
  218.                m    manually enabled
  219.              (none) system dependent
  220.             Thus if a feature is marked with "N", it is included
  221.             in the normal, big and huge versions of Vim.
  222.  
  223.                             *+feature-list*
  224.    *+ARP*        Amiga only: ARP support included
  225. N  *+autocmd*        |:autocmd|, automatic commands
  226. m  *+balloon_eval*    |balloon-eval| support
  227. N  *+browse*        |:browse| command
  228. N  *+builtin_terms*    some terminals builtin |builtin-terms|
  229. B  *++builtin_terms*    maximal terminals builtin |builtin-terms|
  230. N  *+byte_offset*    support for 'o' flag in 'statusline' option, "go"
  231.             and ":goto" commands.
  232. N  *+cindent*        |'cindent'|, C indenting
  233. N  *+clientserver*    Unix and Win32: Remote invocation |clientserver|
  234.    *+clipboard*        |clipboard| support
  235. N  *+cmdline_compl*    command line completion |cmdline-completion|
  236. N  *+cmdline_hist*    command line history |cmdline-history|
  237. N  *+cmdline_info*    |'showcmd'| and |'ruler'|
  238. N  *+comments*        |'comments'| support
  239. N  *+cryptv*        encryption support |encryption|
  240. B  *+cscope*        |cscope| support
  241. N  *+dialog_gui*    Support for |:confirm| with GUI dialog.
  242. N  *+dialog_con*    Support for |:confirm| with console dialog.
  243. N  *+dialog_con_gui*    Support for |:confirm| with GUI and console dialog.
  244. N  *+diff*        |vimdiff| and 'diff'
  245. N  *+digraphs*        |digraphs| *E196*
  246. B  *+emacs_tags*    |emacs-tags| files
  247. N  *+eval*        expression evaluation |eval.txt|
  248. N  *+ex_extra*        Vim's extra Ex commands: |:center|, |:left|,
  249.             |:normal|, |:retab| and |:right|
  250. N  *+extra_search*    |'hlsearch'| and |'incsearch'| options.
  251. B  *+farsi*        |farsi| language
  252. N  *+file_in_path*    |gf|, |CTRL-W_f| and |<cfile>|
  253. N  *+find_in_path*    include file searches: |[I|, |:isearch|,
  254.             |CTRL-W_CTRL-I|, |:checkpath|, etc.
  255. N  *+folding*        |folding|
  256.    *+footer*        |gui-footer|
  257.    *+fork*        Unix only: |fork| shell commands
  258. N  *+gettext*        message translations |multi-lang|
  259.    *+GUI_Athena*    Unix only: Athena |GUI|
  260.    *+GUI_BeOS*        BeOS only: BeOS |GUI|
  261.    *+GUI_GTK*        Unix only: GTK+ |GUI|
  262.    *+GUI_Motif*        Unix only: Motif |GUI|
  263.    *+GUI_Photon*    QNX only:  Photon |GUI|
  264. m  *+hangul_input*    Hangul input support |hangul|
  265.    *+iconv*        Compiled with the |iconv()| function, may have |/dyn|
  266. N  *+insert_expand*    |insert_expand| Insert mode completion
  267. N  *+jumplist*        |jumplist|
  268. B  *+keymap*        |'keymap'|
  269. B  *+langmap*        |'langmap'|
  270. N  *+libcall*        |libcall()|
  271. N  *+linebreak*        |'linebreak'|, |'breakat'| and |'showbreak'|
  272. N  *+lispindent*    |'lisp'|
  273. N  *+listcmds*        Vim commands for the list of buffers |buffer-hidden|
  274.             and argument list |:argdelete|
  275. N  *+localmap*        Support for mappings local to a buffer |:map-local|
  276. N  *+menu*        |:menu|
  277. N  *+mksession*        |:mksession|
  278. N  *+modify_fname*    |filename-modifiers|
  279. N  *+mouse*        Mouse handling |mouse-using|
  280. N  *+mouseshape*    |'mouseshape'|
  281. B  *+mouse_dec*        Unix only: Dec terminal mouse handling |dec-mouse|
  282. N  *+mouse_gpm*        Unix only: Linux console mouse handling |gpm-mouse|
  283. B  *+mouse_netterm*    Unix only: netterm mouse handling |netterm-mouse|
  284. N  *+mouse_pterm*    QNX only: pterm mouse handling |qnx-terminal|
  285. N  *+mouse_xterm*    Unix only: xterm mouse handling |xterm-mouse|
  286. B  *+multi_byte*    Korean and other languages |multibyte|
  287.    *+multi_byte_ime*    Win32 input method for multibyte chars |multibyte-ime|
  288. N  *+multi_lang*    non-English language support |multi-lang|
  289. m  *+ole*        Win32 GUI only: |ole-interface|
  290.    *+osfiletype*    Support for the 'osfiletype' option and filetype
  291.             checking in automatic commands.  |autocmd-osfiletypes|
  292. N  *+path_extra*    Up/downwards search in 'path' and 'tags'
  293. m  *+perl*        Perl interface |perl|, may have |/dyn|
  294.    *+postscript*    |:hardcopy| writes a PostScript file
  295. N  *+printer*        |:hardcopy| command
  296. m  *+python*        Python interface |python|, may have |/dyn|
  297. N  *+quickfix*        |:make| and |quickfix| commands
  298. B  *+rightleft*        Right to left typing |'rightleft'|
  299. m  *+ruby*        Ruby interface |ruby|, may have |/dyn|
  300. N  *+scrollbind*    |'scrollbind'|
  301. B  *+signs*        |:sign|
  302. N  *+smartindent*    |'smartindent'|
  303. m  *+sniff*        SniFF interface (no docs available...)
  304. N  *+statusline*    Options 'statusline', 'rulerformat' and special
  305.             formats of 'titlestring' and 'iconstring'
  306.    *+sun_workshop*    |workshop|
  307. N  *+syntax*        Syntax highlighting |syntax|
  308.    *+system()*        Unix only: opposite of |+fork|
  309. N  *+tag_binary*    binary searching in tags file |tag-binary-search|
  310. N  *+tag_old_static*    old method for static tags |tag-old-static|
  311. m  *+tag_any_white*    any white space allowed in tags file |tag-any-white|
  312. m  *+tcl*        Tcl interface |tcl|, may have |/dyn|
  313.    *+terminfo*        uses |terminfo| instead of termcap
  314. N  *+termresponse*    support for |t_RV| and |v:termresponse|
  315. N  *+textobjects*    |text-objects| selection
  316.    *+tgetent*        non-Unix only: able to use external termcap
  317. N  *+title*        Setting the window title |'title'|
  318. N  *+toolbar*        |gui-toolbar|
  319. N  *+user_commands*    User-defined commands. |user-commands|
  320. N  *+viminfo*        |'viminfo'|
  321. N  *+vertsplit*        Vertically split windows |:vsplit|
  322. N  *+virtualedit*    |'virtualedit'|
  323. S  *+visual*        Visual mode |Visual-mode|
  324. N  *+visualextra*    extra Visual mode commands |blockwise-operators|
  325. N  *+vreplace*        |gR| and |gr|
  326. N  *+wildignore*    |'wildignore'|
  327. N  *+wildmenu*        |'wildmenu'|
  328. S  *+windows*        more than one window
  329. m  *+writebackup*    |'writebackup'| is default on
  330. m  *+xim*        X input method |xim|
  331.    *+xfontset*        X fontset support |xfontset|
  332. N  *+xterm_clipboard*    Unix only: xterm clipboard handling
  333. m  *+xterm_save*    save and restore xterm screen |xterm-screens|
  334. N  *+X11*        Unix only: can restore window title |X11|
  335.  
  336.                                 */dyn*
  337.             To some of the features "/dyn" is added when the
  338.             feature is only available when the related library can
  339.             be dynamically loaded.
  340.  
  341. :ve[rsion] {nr}        Is now ignored.  This was previously used to check the
  342.             version number of a .vimrc file.  It was removed,
  343.             because you can now use the ":if" command for
  344.             version-dependent behavior.  {not in Vi}
  345.  
  346.                             *:redi* *:redir*
  347. :redi[r][!] > {file}    Redirect messages to file {file}.  The messages which
  348.             are the output of commands are written to that file,
  349.             until redirection ends.  The messages are also still
  350.             shown on the screen.  When [!] is included, an
  351.             existing file is overwritten.  When [!] is omitted,
  352.             and {file} exists, this command fails.
  353.             To stop the messages and commands from being echoed to
  354.             the screen, put the commands in a function and call it
  355.             with ":silent call Function()".
  356.             {not in Vi}
  357.  
  358. :redi[r] >> {file}    Redirect messages to file {file}.  Append if {file}
  359.             already exists.  {not in Vi}
  360.  
  361. :redi[r] @{a-zA-Z}    Redirect messages to register {a-z}.  Append to the
  362.             contents of the register if its name is given
  363.             uppercase {A-Z}.  {not in Vi}
  364.  
  365. :redi[r] @*        Redirect messages to the clipboard. {not in Vi}
  366.  
  367. :redi[r] @"        Redirect messages to the unnamed register. {not in Vi}
  368.  
  369. :redi[r] END        End redirecting messages.  {not in Vi}
  370.  
  371.                         *:sil* *:silent*
  372. :sil[ent][!] {command}    Execute {command} silently.  Normal messages will not
  373.             be given.
  374.             When [!] is added, error messages will also be
  375.             skipped, and commands and mappings will not be aborted
  376.             when an error is detected.  |v:errmsg| is still set.
  377.             When [!] is not used, an error message will cause
  378.             further messages to be displayed normally.
  379.             Redirection, started with |:redir|, will continue as
  380.             usual, although there might be small differences.
  381.             This will allow redirecting the output of a command
  382.             without seeing it on the screen.  Example: >
  383.                 :redir >/tmp/foobar
  384.                 :silent g/Aap/p
  385.                 :redir END
  386. <            To execute a Normal mode command silently, use the
  387.             |:normal| command.  For example, to search for a
  388.             string without messages: >
  389.                 :silent exe "normal /path\<CR>"
  390. <            ":silent!" is useful to execute a command that may
  391.             fail, but the failure is to be ignored.  Example: >
  392.                 :let v:errmsg = ""
  393.                 :silent! /^begin
  394.                 :if v:errmsg != ""
  395.                 : ... pattern was not found
  396. <            ":silent" will also avoid the hit-enter prompt.  When
  397.             using this for an external command, this may cause the
  398.             screen to be messed up.  Use |CTRL-L| to clean it up
  399.             then.
  400.             ":silent menu ..." defines a menu that will not echo a
  401.             Command-line command.  The command will still produce
  402.             messages though.  Use ":silent" in the command itself
  403.             to avoid that: ":silent menu .... :silent command".
  404.  
  405.                         *:verb* *:verbose*
  406. :[count]verb[ose] {command}
  407.             Execute {command} with 'verbose' set to [count].  If
  408.             [count] is omitted one is used.
  409.             The additional use of ":silent" makes messages
  410.             generated but not displayed.
  411.             The combination of ":silent" and ":verbose" can be
  412.             used to generate messages and check them with
  413.             |v:statusmsg| and friends.  For example: >
  414.                 :let v:statusmsg = ""
  415.                 :silent verbose runtime foobar.vim
  416.                 :if v:statusmsg != ""
  417.                 :  " foobar.vim could not be found
  418.                 :endif
  419. <            When concatenating another command, the ":verbose"
  420.             only applies to the first one: >
  421.                 :4verbose set verbose | set verbose
  422. <                  verbose=4 ~
  423.                   verbose=0 ~
  424.  
  425.                             *K*
  426. K            Run a program to lookup the keyword under the
  427.             cursor.  The name of the program is given with the
  428.             'keywordprg' (kp) option (default is "man").  The
  429.             keyword is formed of letters, numbers and the
  430.             characters in 'iskeyword'.  The keyword under or
  431.             right of the cursor is used.  The same can be done
  432.             with the command >
  433.                 :!{program} {keyword}
  434. <            There is an example of a program to use in the tools
  435.             directory of Vim.  It is called 'ref' and does a
  436.             simple spelling check.
  437.             Special cases:
  438.             - If 'keywordprg' is empty, the ":help" command is
  439.               used.  It's a good idea to include more characters
  440.               in 'iskeyword' then, to be able to find more help.
  441.             - When 'keywordprg' is equal to "man", a count before
  442.               "K" is inserted after the "man" command and before
  443.               the keyword.  For example, using "2K" while the
  444.               cursor is on "mkdir", results in: >
  445.                 !man 2 mkdir
  446. <            - When 'keywordprg' is equal to "man -s", a count
  447.               before "K" is inserted after the "-s".  If there is
  448.               no count, the "-s" is removed.
  449.             {not in Vi}
  450.  
  451.                             *v_K*
  452. {Visual}K        Like "K", but use the visually highlighted text for
  453.             the keyword.  Only works when the highlighted text is
  454.             not more than one line.  {not in Vi}
  455.  
  456. [N]gs                            *gs* *:sl* *:sleep*
  457. :[N]sl[eep] [N]    [m]    Do nothing for [N] seconds.  When [m] is included,
  458.             sleep for [N] milliseconds. The count for "gs" always
  459.             uses seconds.  The default is one second. >
  460.   :sleep      "sleep for one second
  461.   :5sleep      "sleep for five seconds
  462.   :sleep 100m     "sleep for a hundred milliseconds
  463.   10gs          "sleep for ten seconds
  464. <            Can be interrupted with CTRL-C (CTRL-Break on MS-DOS).
  465.             "gs" stands for "goto sleep".  While sleeping the
  466.             cursor is positioned in the text (if visible).  {not
  467.             in Vi}
  468.  
  469.                             *g_CTRL-A*
  470. g CTRL-A        Only when Vim was compiled with MEM_PROFILING defined
  471.             (which is very rare): print memory usage statistics.
  472.             Only useful for debugging Vim.
  473.  
  474. ==============================================================================
  475. 2. Online help                        *online-help*
  476.  
  477.             *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
  478. <Help>        or
  479. :h[elp]            Open a window and display the help file in read-only
  480.             mode.  If there is a help window open already, use
  481.             that one.  Otherwise, if the current window uses the
  482.             full width of the screen or is at least 80 characters
  483.             wide, the help window will appear just above the
  484.             current window.  Otherwise the new window is put at
  485.             the very top.
  486.             {not in Vi}
  487.  
  488.                             *{subject}* *E149*
  489. :h[elp] {subject}    Like ":help", additionally jump to the tag {subject}.
  490.             {subject} can include wildcards like "*", "?" and
  491.             "[a-z]":
  492.                :help z?    jump to help for any "z" command
  493.                :help z.    jump to the help for "z."
  494.             If there is no full match for the pattern, or there
  495.             are several matches, the "best" match will be used.
  496.             A sophisticated algorithm is used to decide which
  497.             match is better than another one.  These items are
  498.             considered in the computation:
  499.             - A match with same case is much better than a match
  500.               with different case.
  501.             - A match that starts after a non-alphanumeric
  502.               character is better than a match in the middle of a
  503.               word.
  504.             - A match at or near the beginning of the tag is
  505.               better than a match further on.
  506.             - The more alphanumeric characters match, the better.
  507.             - The shorter the length of the match, the better.
  508.             Note that the longer the {subject} you give, the less
  509.             matches will be found.  You can get an idea how this
  510.             all works by using commandline completion (type CTRL-D
  511.             after ":help subject").
  512.             If there are several matches, you can have them listed
  513.             by hitting CTRL-D.  Example: >
  514.                 :help cont<Ctrl-D>
  515. <            To use a regexp |pattern|, first do ":help" and then
  516.             use ":tag {pattern}" in the help window.  The
  517.             ":tnext" command can then be used to jump to other
  518.             matches, "tselect" to list matches and choose one. >
  519.                 :help index| :tse z.
  520. <            This command can be followed by '|' and another
  521.             command, but you don't need to escape the '|' inside a
  522.             help command.  So these both work: >
  523.                 :help |
  524.                 :help k| only
  525. <            Note that a space before the '|' is seen as part of
  526.             the ":help" argument.
  527.             You can also use <LF> or <CR> to separate the help
  528.             command from a following command.  You need to type
  529.             CTRL-V first to insert the <LF> or <CR>.  Example: >
  530.                 :help so<C-V><CR>only
  531. <            {not in Vi}
  532.  
  533. When no argument is given the file given with the 'helpfile' option will be
  534. opened.  Otherwise the specified tag is searched for in all "doc/tags" files
  535. in the directories specified in the 'runtimepath' option.
  536.  
  537. The initial height of the help window can be set with the 'helpheight' option
  538. (default 20).
  539.  
  540. Jump to specific subjects by using tags.  This can be done in two ways:
  541. - Use the "CTRL-]" command while standing on the name of a command or option.
  542.   This only works when the tag is a keyword.  "<C-Leftmouse>" and
  543.   "g<LeftMouse>" work just like "CTRL-]".
  544. - use the ":ta {subject}" command.  This also works with non-keyword
  545.   characters.
  546.  
  547. Use CTRL-T or CTRL-O to jump back.
  548. Use ":q" to close the help window.
  549.  
  550. If there are several matches for an item you are looking for, this is how you
  551. can jump to each one of them:
  552. 1. open a help window
  553. 2. Use the ":tag" command with a slash prepended to the tag.  E.g.: >
  554.     :tag /min
  555. 3. Use ":tnext" to jump to the next matching tag.
  556.  
  557. It is possible to add help files for plugins and other items.  You don't need
  558. to change the distributed help files for that.  See |add-local-help|
  559.  
  560. To write a local help file, see |write-local-help|.
  561.  
  562. Note that the title lines from the local help files are automagically added to
  563. the "LOCAL ADDITIONS" section in the "help.txt" help file.  This is done when
  564. viewing the file in Vim, the file itself is not changed.  It is done by going
  565. through all help files and obtaining the first line of each file.  The files
  566. in $VIMRUNTIME/doc are skipped.
  567.  
  568.                             *help-xterm-window*
  569. If you want to have the help in another xterm window, you could use this
  570. command:
  571.     :!xterm -e vim +help &
  572.  
  573.  
  574.             *:helpfind* *:helpf*
  575. :helpf[ind]        Like |:help|, but use a dialog to enter the argument.
  576.             Only for backwards compatibilty.  It now executes the
  577.             ToolBar.HelpFind menu entry instead of using a builtin
  578.             dialog.  {only when compiled with |+GUI_GTK|}
  579.  
  580.             *:helpt* *:helptags* *E154* *E150* *E151* *E152* *E153*
  581. :helpt[ags] {dir}    Generate the help tags file for directory {dir}.  All
  582.             "*.txt" files in the directory are scanned for a help
  583.             tag definition in between stars.  The generated tags
  584.             file is sorted.  When there are duplicates an error
  585.             message is given.  An existing tags file is silently
  586.             overwritten.
  587.  
  588. ==============================================================================
  589. 3. Printing                        *printing*
  590.  
  591. On MS-Windows Vim can print your text on any installed printer.  On other
  592. systems a PostScript file is produced.  This can be directly sent to a
  593. PostScript printer.  For other printers a program like ghostscript needs to be
  594. used.
  595.  
  596. {not in Vi}
  597. {only available when compiled with |+printer| feature}
  598.  
  599.                     *:ha* *:hardcopy* *E237* *E238* *E324*
  600. :[range]ha[rdcopy][!] [arguments]
  601.             Send [range] lines (default whole file) to the
  602.             printer.
  603.  
  604.             On MS-Windows a dialog is displayed to allow selection
  605.             of printer, paper size etc. To skip the dialog, use
  606.             the [!].  In this case the printer defined by
  607.             'printdevice' is used, or, if 'printdevice' is empty,
  608.             the system default printer.
  609.  
  610.             For systems other than MS-Windows, PostScript is
  611.             written in a temp file and 'printexpr' is used to
  612.             actually print it.  Then [arguments] can be used by
  613.             'printexpr' through |v:cmdarg|.  Otherwise [arguments]
  614.             is ignored.  'printoptions' can be used to specify
  615.             paper size, duplex, etc.
  616.  
  617. :[range]ha[rdcopy][!] >{filename}
  618.             As above, but write the resulting PostScript in file
  619.             {filename}.  Careful: An existing file is silently
  620.             overwritten.
  621.             {only available when compiled with the |+postscript|
  622.             feature}
  623.             On MS-Windows use the "print to file" feature of the
  624.             printer driver.
  625.  
  626. Progress is displayed during printing as a page number and a percentage.  To
  627. abort printing use the interrupt key (CTRL-C or, on MS-systems, CTRL-Break).
  628.  
  629. Printer output is controlled by the 'printfont' and 'printoptions' options.
  630. 'printheader' specifies the format of a page header.
  631.  
  632. The printed file is always limited to the selected margins, irrespective of
  633. the current window's 'wrap' or 'linebreak' settings.  The "wrap" item in
  634. 'printoptions' can be used to switch wrapping off.
  635. The current highlighting colors are used in the printout, with the following
  636. considerations:
  637. 1) The normal background is always rendered as white (i.e. blank paper.)
  638. 2) White text or the default foreground is rendered as black, so that it shows
  639.    up!
  640. 3) If 'background' is "dark", then the colours are darkened to compensate for
  641.    the fact that otherwise they would be too bright to show up clearly on
  642.    white paper.
  643.  
  644.  
  645. 3.1 PostScript Printing
  646.                             *E455* *E456* *E457*
  647. Provided you have enough disk space there should be no problems generating a
  648. PostScript file.  You need to have the runtime files correctly installed (if
  649. you can find the help files, they probably are).
  650.  
  651. There are currently a number of limitations with PostScript printing:
  652.  
  653. - 'printfont' - The font name is ignored (the Courier family is always used -
  654.   it should be available on all PostScript printers) but the font size is
  655.   used.
  656.  
  657. - 'printoptions' - The duplex setting is used when generating PostScript
  658.   output, but it is up to the printer to take notice of the setting.  If the
  659.   printer does not support duplex printing then it should be silently ignored.
  660.   Some printers, however, don't print at all.
  661.  
  662. - 8-bit and Multi-byte support - There is limited support for 8-bit character
  663.   set encodings.  It is based on the Latin-1 encoding, modified for the host
  664.   platform so that what is printed should match what VIM displays on screen.
  665.   There is no support for multi-byte character sets - the characters are
  666.   replaced with spaces.
  667.  
  668.  
  669. 3.2 PostScript Printing Troubleshooting
  670.  
  671. Usually the only sign of a problem when printing with PostScript is that your
  672. printout does not appear.  If you are lucky you may get a printed page that
  673. tells you the PostScript operator that generated the error that prevented the
  674. print job completing.
  675.  
  676. There are a number of possible causes as to why the printing may have failed:
  677.  
  678. - Paper size.  Some PostScript printers will abort printing a file if they do
  679.   not support the requested paper size.  By default VIM uses A4 paper.  Find
  680.   out what size paper your printer normally uses and set the appropriate paper
  681.   size with 'printoptions'.  If you cannot find the name of the paper used,
  682.   measure a sheet and compare it with the table of supported paper sizes listed
  683.   for 'printoptions', using the paper that is closest in both width AND height.
  684.   Note: The dimensions of actual paper may vary slightly from the ones listed.
  685.   If there is no paper listed close enough, then you may want to try psresize
  686.   from PSUtils, discussed below.
  687.  
  688. - Two-sided printing (duplex).  Normally a PostScript printer that does not
  689.   support two-sided printing will ignore any request to do it.  However, some
  690.   printers may abort the job altogether.  Try printing with duplex turned off.
  691.   Note: Duplex prints can be achieved manually using PS utils - see below.
  692.  
  693. - Collated printing.  As with Duplex printing, most PostScript printers that
  694.   do not support collating printouts will ignore a request to do so.  Some may
  695.   not.  Try printing with collation turned off.
  696.  
  697. - Syntax highlighting.  Some print management code may prevent the generated
  698.   PostScript file from being printed on a black and white printer when syntax
  699.   highlighting is turned on, even if solid black is the only color used.  Try
  700.   printing with syntax highlighting turned off.
  701.  
  702. A safe printoptions setting to try is: >
  703.  
  704.     :set printoptions=paper:A4,duplex:off,collate:n,syntax:n
  705.  
  706. Replace "A4" with the paper size that best matches your printer paper.
  707.  
  708.  
  709. 3.3 PostScript Utilities
  710.  
  711. 3.3.1 Ghostscript
  712.  
  713. Ghostscript is a PostScript and PDF interpreter that can be used to display
  714. and print on non-PostScript printers PostScript and PDF files.  It can also
  715. generate PDF files from PostScript.
  716.  
  717. Ghostscript will run on a wide variety of platforms.
  718.  
  719. There are three available versions:
  720.  
  721. - AFPL Ghostscript (formerly Aladdin Ghostscript) which is free for
  722.   non-commercial use.  It can be obtained from:
  723.  
  724.     http://www.cs.wisc.edu/~ghost/
  725.  
  726. - GNU Ghostscript which is available under the GNU General Public License.  It
  727.   can be obtained from:
  728.  
  729.     ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/ 
  730.  
  731. - A commercial version for inclusion in commercial products.
  732.  
  733. Additional information on Ghostscript can also be found at:
  734.  
  735.   http://www.ghostscript.com/
  736.  
  737. Support for a number of non PostScript printers is provided in the
  738. distribution as standard, but if you cannot find support for your printer
  739. check the Ghostscript site for other printers not included by default.
  740.  
  741.  
  742. 3.3.2 Ghostscript Previewers.
  743.  
  744. The interface to Ghostscript is very primitive so a number of graphical front
  745. ends have been created.  These allow easier PostScript file selection,
  746. previewing at different zoom levels, and printing.  Check supplied
  747. documentation for full details.
  748.  
  749. X11
  750.  
  751. - Ghostview.  Obtainable from:
  752.  
  753.     http://www.cs.wisc.edu/~ghost/gv/ 
  754.  
  755. - gv.  Derived from Ghostview.  Obtainable from:
  756.  
  757.     http://wwwthep.physik.uni-mainz.de/~plass/gv/ 
  758.   
  759.   Copies (possibly not the most recent) can be found at:
  760.  
  761.     http://www.cs.wisc.edu/~ghost/gv/
  762.  
  763. OpenVMS
  764.  
  765. - gv-vms.  A port of gv to OpenVMS.  Obtainable from:    
  766.  
  767.     ftp://axp.psl.ku.dk/decwindows/xaw3d/
  768.     ftp://ftp.wku.edu/vms/fileserv/x11kit.zip
  769.  
  770. Windows and OS/2
  771.  
  772. - GSview.  Obtainable from:
  773.  
  774.     http://www.cs.wisc.edu/~ghost/gsview/ 
  775.  
  776. DOS
  777.  
  778. - ps_view.  Obtainable from:
  779.  
  780.     ftp://ftp.pg.gda.pl/pub/TeX/support/ps_view/
  781.     ftp://ftp.dante.de/tex-archive/support/ps_view/ 
  782.  
  783. Linux
  784.  
  785. - GSview.  Linux version of the popular Windows and OS/2 previewer.
  786.   Obtainable from:
  787.  
  788.     http://www.cs.wisc.edu/~ghost/gsview/ 
  789.  
  790. - BMV.  Different to Ghostview and gv in that it doesn't use X but svgalib.
  791.   Obtainable from:
  792.  
  793.     ftp://sunsite.unc.edu/pub/Linux/apps/graphics/viewers/svga/bmv-1.2.tgz 
  794.  
  795.  
  796. 3.3.3 PSUtils
  797.  
  798. PSUtils is a collection of utility programs for manipulating PostScript
  799. documents.  Binary distributions are available for many platforms, as well as
  800. the full source.  PSUtils can be found at:
  801.  
  802.   http://www.dcs.ed.ac.uk/home/ajcd/psutils/
  803.  
  804. The utilities of interest include:
  805.  
  806. - psnup.     Convert PS files for N-up printing.
  807. - psselect.  Select page range and order of printing.
  808. - psresize.  Change the page size.
  809. - psbook.    Reorder and lay out pages ready for making a book.
  810.  
  811. The output of one program can be used as the input to the next, allowing for
  812. complex print document creation.
  813.  
  814.  
  815. N-UP PRINTING
  816.  
  817. The psnup utility takes an existing PostScript file generated from VIM and
  818. convert it to an n-up version.  The simplest way to create a 2-up printout is
  819. to first create a PostScript file with: >
  820.  
  821.     :hardcopy > test.ps
  822.  
  823. Then on your command line execute: >
  824.  
  825.     psnup -n 2 test.ps final.ps
  826.  
  827. Note: You may get warnings from some Ghostscript previewers for files produced
  828. by psnup - these may safely be ignored.
  829.  
  830. Finally print the file final.ps to your PostScript printer with your
  831. platform's print command.  (You will need to delete the two PostScript files
  832. afterwards yourself.)  'printexpr' could be modified to perform this extra
  833. step before printing.
  834.  
  835.  
  836. ALTERNATE DUPLEX PRINTING
  837.  
  838. It is possible to achieve a poor man's version of duplex printing using the PS
  839. utility psselect.  This utility has options -e and -o for printing just the
  840. even or odd pages of a PS file respectively.
  841.  
  842. First generate a PS file with the 'hardcopy' command, then generate a new
  843. files with all the odd and even numbered pages with: >
  844.  
  845.     psselect -o test.ps odd.ps
  846.     psselect -e test.ps even.ps
  847.  
  848. Next print odd.ps with your platform's normal print command.  Then take the
  849. print output, turn it over and place it back in the paper feeder.  Now print
  850. even.ps with your platform's print command.  All the even pages should now
  851. appear on the back of the odd pages.
  852.  
  853. There a couple of points to bear in mind:
  854.  
  855. 1. Position of the first page.  If the first page is on top of the printout
  856.    when printing the odd pages then you need to reverse the order that the odd
  857.    pages are printed.  This can be done with the -r option to psselect.  This
  858.    will ensure page 2 is printed on the back of page 1.
  859.    Note: it is better to reverse the odd numbered pages rather than the even
  860.    numbered in case there are an odd number of pages in the original PS file.
  861.  
  862. 2. Paper flipping.  When turning over the paper with the odd pages printed on
  863.    them you may have to either flip them horizontally (along the long edge) or
  864.    vertically (along the short edge), as well as possibly rotating them 180
  865.    degrees.  All this depends on the printer - it will be more obvious for
  866.    desktop ink jets than for small office laser printers where the paper path
  867.    is hidden from view.
  868.  
  869.  
  870. ==============================================================================
  871. 4. Using Vim like less or more                    *less*
  872.  
  873. If you use the less or more program to view a file, you don't get syntax
  874. highlighting.  Thus you would like to use Vim instead.  You can do this by
  875. using the shell script "$VIMRUNTIME/macros/less.sh".
  876.  
  877. This shell script uses the Vim script "$VIMRUNTIME/macros/less.vim".  It sets
  878. up mappings to simulate the commands that less supports.  Otherwise, you can
  879. still use the Vim commands.
  880.  
  881. This isn't perfect.  For example, when viewing a short file Vim will still use
  882. the whole screen.  But it works good enough for most uses, and you get syntax
  883. highlighting.
  884.  
  885. The "h" key will give you a short overview of the available comands.
  886.  
  887.  vim:tw=78:ts=8:ft=help:norl:
  888.